package com.tiancheng.trade.payment.controller.admin;

import com.tiancheng.trade.commom.core.data.Result;
import com.tiancheng.trade.payment.service.PaymentChannelService;
import com.tiancheng.trade.payment.vo.admin.PaymentChannelAddVO;
import com.tiancheng.trade.payment.vo.admin.PaymentChannelReqVO;
import org.springframework.http.MediaType;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import jakarta.validation.Valid;

/**
 * 支付渠道
 */
@RestController
@RequestMapping("/admin/paymentChannel")
@Validated
public class PaymentChannelController {

    @Resource
    PaymentChannelService paymentChannelService;

    /**
     * 添加支付渠道
     * @param paymentChannelVO
     * @return
     */
    @PostMapping(value = "", consumes = MediaType.APPLICATION_JSON_VALUE)
    public Result add(@RequestBody @Valid PaymentChannelAddVO paymentChannelVO){
    	paymentChannelService.add(paymentChannelVO);
        return Result.success();
    }

    /**
     * 分页查询支付渠道
     * @param requestData
     * @return
     */
    @GetMapping("/getList")
    public Result findList(PaymentChannelReqVO requestData){
        return Result.success(paymentChannelService.findList(requestData));
    }

    /**
     * 获取所有支付渠道
     * @return
     */
    @GetMapping("/getAll")
    public Result getAll() {
        return Result.success(paymentChannelService.getAllConvert());
    }

}
